var mi;
var waveid;
var ideg = 0;
$(function(){
	//初始化
	tantiao();
	musicmove();
	waveid = setInterval("tantiao()",1100);
	//点击开启
	$(".innerclick,.outclick").click(function(){
	 	$(".start").fadeOut(600,function(){
	 		$(".content").fadeIn(600);
	 		clearInterval(waveid);
	 		jiantoumove();
	 		setInterval("jiantoumove()",1100);
	 		$(".jiantou").show();
	 		$(".jttip").show();
	 	});
	});
	 //音乐控制相关
	 var bgaudio = document.getElementById("bgmusic");
	 bgaudio.loop = true;
	 var num = 0;
	 $("#musiccon").click(function(){
	 	if(num == 0){
	 		num = 1;
	 		musicstop();
	 		bgaudio.pause();
	 	}else if(num == 1){
	 		num = 0;
	 		musicmove();
	 		bgaudio.play();
	 	}
	 });
});



function tantiao(){
	$(".outclick").fadeIn(550,function(){
	 	$(this).fadeOut(550);
	});
	$(".innerclick").fadeIn(550,function(){
	 	$(this).fadeOut(550);
	});
}

function jiantoumove(){
	$(".jiantou").animate({ 
	    right: "25px",
	    opacity: "1"
	  }, 550 ,function(){
	  	$(".jiantou").animate(
	  		{
	  			right: "10px",
	  			opacity: "0"
	  		},550
	  	);
	  });
}
//音乐控制相关
function musiccontrol(){
	ideg += 5;
	if(ideg >= 360){
		ideg = 0;
	}
	$("#musiccon").css({
		"transform": "rotate("+ ideg +"deg)",
		"-ms-transform": "rotate("+ ideg +"deg)",
		"-webkit-transform": "rotate("+ ideg +"deg)",
		"-o-transform": "rotate("+ ideg +"deg)",
		"-moz-transform": "rotate("+ ideg +"deg)"
	});
}

function musicmove(){
	clearInterval(mi);
	mi = setInterval("musiccontrol()",50);
}

function musicstop(){
	clearInterval(mi);
}
